Add tuh_hid_get_report(...) to hid_host.h #2223
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the PR
This allows USB host functionality to call HID_REQ_CONTROL_GET_REPORT on the TUSB_DIR_IN direction, and read the report buffer in the callback function.
This extends the functionality of the hid_host.h/.c files and gives the host a way to call the HID get report features.
Additional context
I'm one of the main developers of https://gp2040-ce.info/ and we extensively use the TinyUSB library to handle USB calls. I wanted to try to keep our TUSB host code as hid_host friendly as possible, but I could not find a good way to call GET REPORT feature on the IN direction.
I just added a new authentication pass-through mode which requires 3 GET REPORT calls and 1 SET REPORT call to complete the authentication transaction. In order for our TUSB host to talk to the DS4 authentication mechanism, we have to run get report on the DS4 specific features and read in the buffer .
Right now, I manually added it to our program by retrieving the itf_num on hid_mount through the tuh_hid_mount_cb functionality, then passing that to the tuh_hid_get_report function we declare statically in our USB host manager code. This patch moves the functionality to the TinyUSB for anyone else who needs a get report feature call using hid_host.h callbacks.